<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>UIDL Demo</title>
<!-- Bootstrap -->
<link href="webjars/bootstrap/3.3.1/css/bootstrap.min.css"
	rel="stylesheet">
<!-- <link href="webjars/bootstrap/3.3.1/css/bootstrap-theme.min.css"
	rel="stylesheet"> -->
<link href="webjars/zTree/3.5.15/css/zTreeStyle/zTreeStyle.css"
	rel="stylesheet">
<link href="webjars/codemirror/4.8/lib/codemirror.css" rel="stylesheet">

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
      <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
	<div class="container-fluid">
		<div class="row">
			<div class="col-sm-3">
				<div class="panel panel-default">
					<div class="panel-heading">Outline</div>
					<div class="panel-body">
						<ul id="outline" class="ztree"></ul>
					</div>
				</div>
			</div>
			<div class="col-sm-9">
				<ul class="nav nav-tabs" role="tablist" id="editorTab">
					<li role="presentation" class="active"><a href="#source"
						role="tab" data-toggle="tab">源码</a></li>
					<li role="presentation"><a href="#preview" role="tab"
						data-toggle="tab">预览</a></li>
				</ul>

				<div class="tab-content">
					<div role="tabpanel" class="tab-pane active" id="source">
						<textarea id="srcText" class="form-control"></textarea>
					</div>
					<div role="tabpanel" class="tab-pane" id="preview"></div>
				</div>

			</div>
		</div>
		<!-- row1 end -->
	</div>
	<!-- container end -->

	<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
	<script src="webjars/jquery/1.11.1/jquery.min.js"></script>
	<!-- Include all compiled plugins (below), or include individual files as needed -->
	<script src="webjars/bootstrap/3.3.1/js/bootstrap.min.js"></script>
	<script src="webjars/zTree/3.5.15/js/jquery.ztree.core.min.js"></script>
	<script src="webjars/codemirror/4.8/lib/codemirror.js"></script>
	<script src="webjars/codemirror/4.8/mode/javascript/javascript.js"></script>
	<script src="webjars/codemirror/4.8/addon/edit/matchbrackets.js"></script>
	<script src="webjars/codemirror/4.8/addon/edit/closebrackets.js"></script>
	<script>
		var setting = {};

		var zNodes = [ {
			name : "父节点1 - 展开",
			open : true,
			children : [ {
				name : "父节点11 - 折叠",
				children : [ {
					name : "叶子节点111"
				}, {
					name : "叶子节点112"
				}, {
					name : "叶子节点113"
				}, {
					name : "叶子节点114"
				} ]
			} ]
		} ];

		var editor = CodeMirror.fromTextArea(
				document.getElementById("srcText"), {
					lineNumbers : true,
					matchBrackets : true,
					autoCloseBrackets : true,
					mode : "application/json",
					lineWrapping : true
				});

		$.fn.zTree.init($("#outline"), setting, zNodes);
	</script>
</body>
</html>